
var Text;

function button() {
	var form=document.getElementById("form");
	if( Text.length>0){
		form.name.focus();return;
	}else{
		localStorage.setItem("name", document.getElementById("Blur").value);
		form.action="WebChat.jsp";
		form.submit();
	}
}

function onerror() {
	alert("检验出错！");
}

function checkname(name) {
	var loader = new net.AjaxRequest("CheckServlet?name=" + name.value, dealInfo, onerror, "GET", null);
}

function dealInfo() {
	Text=this.request.responseText;
	document.getElementById("check").innerHTML = Text;
	button();
}

document.onkeydown = function(e){
	var keynum = window.event ? e.keyCode : e.which;
	if(keynum==13){
		 document.getElementById("Blur").blur();
	}
}